-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(analytics): Transform analytics events for TET-827 #95207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Transform event classes to use @analytics.eventclass decorator - Transform analytics.record calls to use event class instances - Update imports as needed Closes TET-827
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing User ID in Integration Comments Sync Event
The IntegrationIssueCommentsSyncedEvent
analytics call in src/sentry/integrations/tasks/create_comment.py
and src/sentry/integrations/tasks/update_comment.py
no longer captures the user_id
parameter. This is because the user_id
field was removed from the IntegrationIssueCommentsSyncedEvent
class, leading to a loss of user tracking data that was previously captured and may impact downstream analytics consumers.
src/sentry/integrations/tasks/create_comment.py#L70-L77
sentry/src/sentry/integrations/tasks/create_comment.py
Lines 70 to 77 in 4867cdb
note.save() | |
analytics.record( | |
IntegrationIssueCommentsSyncedEvent( | |
provider=installation.model.provider, | |
id=installation.model.id, | |
organization_id=external_issue.organization_id, | |
) | |
) |
src/sentry/integrations/tasks/update_comment.py#L70-L77
sentry/src/sentry/integrations/tasks/update_comment.py
Lines 70 to 77 in 4867cdb
installation.update_comment(external_issue.key, user_id, note) | |
analytics.record( | |
IntegrationIssueCommentsSyncedEvent( | |
provider=installation.model.provider, | |
id=installation.model.id, | |
organization_id=external_issue.organization_id, | |
) | |
) |
Bug: Event ID Type Mismatch Causes Serialization Errors
The id
field in IntegrationResolvePREvent
is incorrectly typed as str
. It should be int
to match the repo.integration_id
value passed to it, which is an integer database ID. This also creates an inconsistency with IntegrationResolveCommitEvent.id
, which is correctly typed as int
and uses the same value. This type mismatch can lead to runtime errors or data serialization issues.
src/sentry/integrations/analytics.py#L74-L79
sentry/src/sentry/integrations/analytics.py
Lines 74 to 79 in 4867cdb
@analytics.eventclass("integration.resolve.pr") | |
class IntegrationResolvePREvent(analytics.Event): | |
provider: str | None | |
id: str | |
organization_id: str |
Bug: Type Mismatch in Analytics Event IDs
Analytics event classes define organization_id
, project_id
, and group_id
as str
. However, these fields are consistently populated with integer IDs from model objects (e.g., project.id
, group.id
), leading to type mismatches and errors.
src/sentry/analytics/events/first_new_feedback_sent.py#L5-L7
sentry/src/sentry/analytics/events/first_new_feedback_sent.py
Lines 5 to 7 in 4867cdb
class FirstNewFeedbackSentEvent(analytics.Event): | |
organization_id: str | |
project_id: str |
src/sentry/analytics/events/first_sourcemaps_sent.py#L6-L11
sentry/src/sentry/analytics/events/first_sourcemaps_sent.py
Lines 6 to 11 in 4867cdb
user_id: int | |
organization_id: str | |
project_id: str | |
platform: str | None = None | |
url: str | None = None | |
project_platform: str | None = None |
src/sentry/analytics/events/issue_deleted.py#L5-L11
sentry/src/sentry/analytics/events/issue_deleted.py
Lines 5 to 11 in 4867cdb
class IssueDeletedEvent(analytics.Event): | |
group_id: str | |
delete_type: str | |
organization_id: str | |
project_id: str | |
user_id: str | None = None | |
default_user_id: str |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Closes TET-827